<?php


namespace app\task\controller;


use app\BaseController;
use think\facade\Db;

class ZftOrder extends BaseController
{
    public function test(){
        echo "yangzl";
    }
    ///统计
    public function statistics(){
        $gatelist=Db::table("community")->select();
        $gmt_payment_start=date("Y-m-d",strtotime("-1 day"));
        $gmt_payment_end=date("Y-m-d");
        foreach ($gatelist as $gateinfo){

//            $res=Db::table("statis")->where("community_id",$gatelist["community_id"])->where("day",$gmt_payment_start)->find();
//            if(empty($res)){
//                $info["community_id"]=$community["community_id"];
//                $info["community_name"]=$community["community_name"];
//
//                $info["alipay"]=Db::name('bill')
//                    ->where('community_id',$community["community_id"] )
//                    ->where('status','TRADE_SUCCESS')
//                    ->where('pay_type','支付宝')
//                    ->where('gmt_payment' , '>=' , $gmt_payment_start)
//                    ->where('gmt_payment' , '<=' , $gmt_payment_end)
//                    ->sum('bill_entry_amount');
//                $info["wechat"]=Db::name('bill')
//                    ->where('community_id',$community["community_id"] )
//                    ->where('status','TRADE_SUCCESS')
//                    ->where('pay_type','微信')
//                    ->where('gmt_payment' , '>=' , $gmt_payment_start)
//                    ->where('gmt_payment' , '<=' , $gmt_payment_end)
//                    ->sum('bill_entry_amount');
//                $info["pos"]=Db::name('bill')
//                    ->where('community_id',$community["community_id"] )
//                    ->where('status','TRADE_SUCCESS')
//                    ->where('pay_type','POS')
//                    ->where('gmt_payment' , '>=' , $gmt_payment_start)
//                    ->where('gmt_payment' , '<=' , $gmt_payment_end)
//                    ->sum('bill_entry_amount');
//                $info["cash"]=Db::name('bill')
//                    ->where('community_id',$community["community_id"] )
//                    ->where('status','TRADE_SUCCESS')
//                    ->where('pay_type','现金')
//                    ->where('gmt_payment' , '>=' , $gmt_payment_start)
//                    ->where('gmt_payment' , '<=' , $gmt_payment_end)
//                    ->sum('bill_entry_amount');
//                $info["money"]=Db::name('bill')
//                    ->where('community_id',$community["community_id"] )
//                    ->where('status','TRADE_SUCCESS')
//                    ->where('gmt_payment' , '>=' , $gmt_payment_start)
//                    ->where('gmt_payment' , '<=' , $gmt_payment_end)
//                    ->sum('bill_entry_amount');
//                $info["roomnumber"]=Db::name('bill')
//                    ->where('community_id',$community["community_id"] )
//                    ->where('status','TRADE_SUCCESS')
//                    ->where('gmt_payment' , '>=' , $gmt_payment_start)
//                    ->where('gmt_payment' , '<=' , $gmt_payment_end)
//                    ->count();
//                $info["day"]=$gmt_payment_start;
//                Db::table("statis")->insert($info);
//            }

        }
    }
}